import onnx
from onnxsim import simplify


onnx_model = onnx.load('/home/ngi/IdeaProjects/mmlab/mmpose/hrnet_w48_coco_wholebody_384x288_dark-f5726563_20200918.onnx')  # load onnx model
model_simp, check = simplify(onnx_model)
assert check, "Simplified ONNX model could not be validated"
onnx.save(model_simp, '/home/ngi/IdeaProjects/mmlab/mmpose/hrnet_w48_coco_wholebody_384x288_dark-f5726563_20200918-simplify.onnx')
print('finished exporting onnx')